/**
 * class 类
*/

//静态方法
class obj {
  constructor (name) {
    this.name = name || '鸣人';
  }

  doing() {
    console.log(`${this.name} doing something!`)
  }

  static create(name) {
    return new obj(name);
  }
}
const Obj = obj.create();

// Obj.doing();

/**
 * 类的继承
*/
class obj1 extends obj {
  constructor(name, age) {
    //spuer 始终指向父类，调用spuer就是调用了父类的构造函数
    super(name);
    this.age = age || 18;
  }

  des() {
    super.doing();
    console.log(`${this.name} is ${this.age} years old!`)
  }

}

const Obj1 = new obj1('李',22);

// Obj1.des();

/**
 * class 类 内部所有定义的方法，都是不可枚举的（non-enumerable）
*/
class Point {
  constructor(x, y) {
    this.x = x;
    this.y = y;
  }

  toString() {
    //....
  }
}

console.log(Object.keys(Point.prototype));  // []
console.log(Object.getOwnPropertyNames(Point.prototype));  // [ 'constructor', 'toString' ]
